package com.replication.jdbc.statement;

import java.sql.SQLException;
import java.sql.Statement;

public class StatementOpts {
    String cursorName;
    Boolean escapeProcessing;
    Integer fetchDirection;
    Integer fetchSize;
    Integer maxFieldSize;
    Integer maxRows;
    Boolean poolable;
    Integer queryTimeout;

    public StatementOpts() {
    }

    public String getCursorName() {
        return this.cursorName;
    }

    public void setCursorName(String cursorName) {
        this.cursorName = cursorName;
    }

    public boolean isEscapeProcessing() {
        return this.escapeProcessing.booleanValue();
    }

    public void setEscapeProcessing(boolean escapeProcessing) {
        this.escapeProcessing = Boolean.valueOf(escapeProcessing);
    }

    public int getFetchDirection() {
        return this.fetchDirection.intValue();
    }

    public void setFetchDirection(int fetchDirection) {
        this.fetchDirection = Integer.valueOf(fetchDirection);
    }

    public int getFetchSize() {
        return this.fetchSize.intValue();
    }

    public void setFetchSize(int fetchSize) {
        this.fetchSize = Integer.valueOf(fetchSize);
    }

    public int getMaxFieldSize() {
        return this.maxFieldSize.intValue();
    }

    public void setMaxFieldSize(int maxFieldSize) {
        this.maxFieldSize = Integer.valueOf(maxFieldSize);
    }

    public int getMaxRows() {
        return this.maxRows.intValue();
    }

    public void setMaxRows(int maxRows) {
        this.maxRows = Integer.valueOf(maxRows);
    }

    public boolean isPoolable() {
        return this.poolable.booleanValue();
    }

    public void setPoolable(boolean poolable) {
        this.poolable = Boolean.valueOf(poolable);
    }

    public int getQueryTimeout() {
        return this.queryTimeout.intValue();
    }

    public void setQueryTimeout(int queryTimeout) {
        this.queryTimeout = Integer.valueOf(queryTimeout);
    }

    public void bound(Statement stmt) throws SQLException {
        if(this.cursorName != null) {
            stmt.setCursorName(this.cursorName);
        }

        if(this.fetchDirection != null) {
            stmt.setFetchDirection(this.fetchDirection.intValue());
        }

        if(this.fetchSize != null) {
            stmt.setFetchSize(this.fetchSize.intValue());
        }

        if(this.maxFieldSize != null) {
            stmt.setMaxFieldSize(this.maxFieldSize.intValue());
        }

        if(this.maxRows != null) {
            stmt.setMaxRows(this.maxRows.intValue());
        }

        if(this.queryTimeout != null) {
            stmt.setQueryTimeout(this.queryTimeout.intValue());
        }

        if(this.escapeProcessing != null) {
            stmt.setEscapeProcessing(this.escapeProcessing.booleanValue());
        }

        if(this.poolable != null) {
            stmt.setPoolable(this.poolable.booleanValue());
        }

    }
}
